package com.zxj.judge.controller;

import com.zxj.api.domain.dto.JudgeSubmitDTO;
import com.zxj.api.domain.vo.UserQuestionResultVO;
import com.zxj.common.core.controller.BaseController;
import com.zxj.common.core.domain.R;
import com.zxj.judge.service.IJudgeService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/judge")
@Slf4j
@Tag(name = "JudgeController", description = "判题接口")
public class JudgeController extends BaseController {

    @Autowired
    private IJudgeService judgeService;

    @PostMapping("/doJudgeJavaCode")
    @Operation(summary = "Java判题接口", description = "Java判题接口")
    public R<UserQuestionResultVO> doJudgeJavaCode(@RequestBody JudgeSubmitDTO judgeSubmitDTO) {
        log.info("接收到java语言判题请求,请求参数:{}", judgeSubmitDTO);
        return R.ok(judgeService.doJudgeJavaCode(judgeSubmitDTO));
    }
}
